package Pattern.singleton;

import com.sun.org.apache.regexp.internal.RE;

public class ChocolateBoiler {
    private static ChocolateBoiler chocolateBoiler;
    private boolean empty;
    private boolean boiled;

    private ChocolateBoiler() {
        empty=true;
        boiled=false;
    }

    public static synchronized ChocolateBoiler getChocolateBoiler(){
        if(chocolateBoiler==null){
            chocolateBoiler=new ChocolateBoiler();
        }
        return chocolateBoiler;

    }

    public void fill(){
        if (isEmpty()){
            empty=false;
            boiled=false;
        }
    }

    public void drain(){
        if (!isEmpty()&&isBoiled()){
            empty=true;
        }
    }

    public void boil(){
        if (!isEmpty()&&!isBoiled()){
            boiled=true;
        }
    }

    public boolean isEmpty() {
        return empty;
    }

    public boolean isBoiled(){
        return boiled;
    }



}
